import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif

// #ifdef MP-WEIXIN
try {
  if (typeof wx !== 'undefined') {
    // 兼容：旧版基础库未提供 getStaticSystemInfoSync
    if (typeof wx.getStaticSystemInfoSync !== 'function' && typeof wx.getSystemInfoSync === 'function') {
      wx.getStaticSystemInfoSync = wx.getSystemInfoSync
    }
    // 兼容：若未提供 getWindowInfo，则基于 getSystemInfoSync 返回值构造
    if (typeof wx.getWindowInfo !== 'function' && typeof wx.getSystemInfoSync === 'function') {
      wx.getWindowInfo = function() {
        const info = wx.getSystemInfoSync()
        return {
          pixelRatio: info.pixelRatio,
          windowWidth: info.windowWidth,
          windowHeight: info.windowHeight,
          screenWidth: info.screenWidth,
          screenHeight: info.screenHeight,
          statusBarHeight: info.statusBarHeight,
          safeArea: info.safeArea
        }
      }
    }
  }
} catch (e) {
  // 忽略兼容补丁中的异常
}
// #endif